<?php

/*
 *    A Part of snock project
 *       Author king-of-war
 *      Last modified 2009-5-3
 */
@session_start();
 echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';

$title = 'liujie';
error_reporting(E_ALL ^ E_NOTICE); //去除变量为空时的错误
$root_path = '../';
include_once $root_path . 'admin/smarty_config.php';
include_once $root_path . 'admin/class/verify.class.php';
include_once $root_path . 'admin/class/error.class.php';
include_once $root_path . 'admin/class/count_cfg.class.php';
/*
 * check the right of administrator
 */
$check = new verify($root_path);

$check->identity_check(2);

/*
 *  init operation class
 */
$count_cfg = new count_cfg($root_path);
$row = $count_cfg->count_cfg_get();

/*
 * set data to array $count_cfg
 */
$cfg[0] = $row->get_start();
$cfg[1] = $row->get_temp();
$cfg[2] = $row->get_time();

/*
 * define error class
 */

$error = new Errmsg();

/*
 * define data operat function
 */
if (isset ($_POST['Submit'])) {
	$start = $_POST['start'];
	$time = $_POST['time'];
	$temp = $_POST['temp'];
	$line = $count_cfg->count_cfg_update($start, $temp, $time);
	if ($line) {
		$info = '计数器设定成功';
	} else {
		$info = '计数器设定失败';
	}
	$error->error_chinese($info);
}
/*
 * $temp total counts of templates
 */
$temp = range(1, 11);

/*
 * define the template for this file
 */
$smarty->assign("title", $title);
$smarty->assign("cfg", $cfg);
$smarty->assign("temp", $temp);
$smarty->display("count_cfg.html");
?>

